package com.kitty.game.identity;

import com.kitty.common.db.BaseEntityGame;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Index;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.entity.annotation.TableIndexes;



@Table("t_identity")
@TableIndexes({@Index(fields = {"type"}, unique = true)})
public class IdentityEnt extends BaseEntityGame<Integer> {
    @Id(auto = false)
    private Integer type;
    @Column
    private int currId;

    public static IdentityEnt valueOf(int type, int seed) {
        IdentityEnt ent = new IdentityEnt();
        ent.type = type;
        ent.currId = seed;

        return ent;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getCurrId() {
        return currId;
    }

    public void setCurrId(int currId) {
        this.currId = currId;
    }

    public synchronized int getNextId() {
        return currId++;
    }

    @Override
    public Integer getId() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }
}
